<extend name="Public/base" />

<block name="body">
    <div class="main-title" style="padding-bottom: 10px;">
        <h2>{$title}</h2>
    </div>
    <div class="row" ng-controller="InventoryCtrl">
            <form action="{:U('inadd')}" method='post' class="form-horizontal" ng-init="init('{$type}')">
            <div class="form-item">
                <div class="controls"></div>
            </div>
            <div class="col-md-12">
                <div class="panel panel-default">
                    <div class="panel-heading" style="padding-bottom: 5px;padding-top: 5px;">
                        <span class="check-tips"><button type="button" ng-click="moreItem()" class='btn btn-primary' >添加新商品</button></span>
                        <if condition="$type eq 'zj'">
                            <a href="{:U('PackageManage/printtag')}" class="btn btn-danger">打印标贴</a>
                        </if>
                    </div>
                    <div class="panel-body" style="padding-bottom: 0px;padding-top: 0px;">
                        <div class="form-item cf">
                            <div class="controls">
                                <div style="border: #000 1px solid;margin-top: 5px;margin-bottom: 5px;" class='data-table table-striped '>
                                    <table  id="tbodyspec">
                                        <thead>
                                        <tr>
                                            <th class="col" width="">商品编码</th>
                                            <th>原包装编码</th>
                                            <th>原包装批次</th>
                                            <th class="col">入库数量</th>
                                            <th class="col">操作</th>
                                        </tr>
                                        </thead>
                                        <tbody id="tbodyspec_a">
                                            <tr ng-repeat="item in items">
                                                <td class="change">
                                                    <select select2 style="height: 30px; width:200px;" ng-change="addproselect($index,x)" ng-model="x">
                                                        <option value="">请选择...</option>
                                                        <option ng-repeat="p in product" value="{{p.BIN}}" >{{p.BIN}}({{p.pname}}{{p.spec}})</option>
                                                    </select>
                                                </td>
                                                <td class="change">
                                                    <select select2 style="height: 30px; width:200px;" ng-change="ybzBINselect($index,x)" name="ybzBIN[]" ng-model="x">
                                                        <option value="">请选择...</option>
                                                        <option ng-repeat="list in item.ybzBINlist" value="{{list.BIN}}" >{{list.BIN}}[{{list.pname}}{{list.spec}}]</option>
                                                    </select>
                                                </td>
                                                <td class="change">
                                                    <select select2 style="height: 30px; width:150px;" name="warn_batch[]" >
                                                        <option value="">请选择...</option>
                                                        <option ng-repeat="ybz in item.ybzlist" value="{{ybz.warn_batch}}" >{{ybz.warn_batch}}</option>
                                                    </select>
                                                </td>

                                                <td>
                                                    <input type="text" class="text input-small hide" name="BIN[]" value="{{item.BIN}}" readonly>
                                                    <input type="number" class="form-control input-2x input" ng-model="item.cnt" name="cnt[]" />
                                                </td>
                                                <td><button type="button" class="btn btn-info" ng-click="removeItem($index)"> - </button></td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="col-md-12">
                <button class="btn confirm btn-danger ajax-post" id="submit" type="submit" target-form="form-horizontal" autocomplete="off">入 库</button>
                <a  class="btn btn-primary" id="fh" onclick="javascript:history.back(-1); return false;">返 回</a>
            </div>
            <br><br>
        </form>
        
        
    </div>
</block>

<block name="script">
    <script type="text/javascript">
        //导航高亮
        highlight_subnav('{:U('Inventory/inadd')}');
    </script>
</block>
